<?php

/*
 *
 */

namespace Ruler;

use Ruler\Context;
use Ruler\Variable;
use Ruler\Rule;

foreach (glob("src/Ruler/*.php") as $filename)
{
    include_once $filename;
}
foreach (glob("src/Ruler/Operator/*.php") as $filename)
{
    include_once $filename;
}

$actualNumPeople = new Variable('actualNumPeople');
$rule = new Rule(
    new Operator\LogicalAnd(array(
        new Operator\LessThanOrEqualTo(new Variable('minNumPeople'), $actualNumPeople),
        new Operator\GreaterThanOrEqualTo(new Variable('maxNumPeople'), $actualNumPeople)
    )),
    function() {
        echo 'YAY!';
    }
);

$context = new Context(array(
    'minNumPeople' => 5,
    'maxNumPeople' => 25,
    'actualNumPeople' => function() {
        return 6;
    },
));

    
//echo '<pre>';
//var_dump($rule);die;

$rule->execute($context); // "Yay!"

?>
